Skip to content

HDDS-15064. [STS] Artifacts for Ranger to Consider S3 Action when Authorizing#10108

Merged
ChenSammi merged 3 commits intoapache:masterfrom
fmorg-git:HDDS-15064
Apr 30, 2026
Merged

HDDS-15064. [STS] Artifacts for Ranger to Consider S3 Action when Authorizing#10108
ChenSammi merged 3 commits intoapache:masterfrom
fmorg-git:HDDS-15064

Conversation

@fmorg-git
Copy link
Copy Markdown
Contributor

Please describe your PR in detail:

  • Currently, ACLs used by Ozone and Ranger are not granular enough. For example, read on volume, read on bucket, and write on key can be used by either s3:PutObjectTagging or s3:DeleteObjectTagging. Similarly, because s3:PutObject requires read on volume, read on bucket, and create and write on key, someone with s3:PutObject access can also call s3:PutObjectTagging (as an example). To prevent having more access than requested (or different access than requested), we need a means of restricting the ACL permissions further by S3 actions.

To do this, we introduce an s3Action field in RequestContext so that if populated, the RangerOzoneAuthorizer would further restrict the permissions according to the S3 action.
Additionally, the OzoneGrant would contain a Set representing the S3 actions that are allowed for an inline policy. If all actions are allowed, then the Set would be empty (or null).

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15064

How was this patch tested?

unit tests

@fmorg-git
Copy link
Copy Markdown
Contributor Author

fmorg-git commented Apr 22, 2026

hi @ChenSammi - this is ready to review when you have a chance. Thanks!
Also @mneethiraj, @spolavarapu, @pradeepagrawal8184, @rameeshm - can we please have someone from Ranger team to review as well? Thanks!

private final Set<IAccessAuthorizer.ACLType> permissions;
/**
* S3 action names (e.g. s3:GetObject) from the session policy. When present, the permissions will be further
* restricted by the set of available S3 actions. An empty (or null) set means all actions granted by the
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

means all actions granted by the permissions are allowed

This implies that each permission maps to specific actions. While this is true at S3 gateway implementation, this is not formally documented, right? I suggest replacing this text with:

means the grant does not enforce any restructions on actions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated - eventually there will be documentation

private final Set<IOzoneObj> objects;
private final Set<IAccessAuthorizer.ACLType> permissions;
/**
* S3 action names (e.g. s3:GetObject) from the session policy. When present, the permissions will be further
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the field name is s3Actions, I suggest dropping prefix s3: in the values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated (made corresponding change in RequestContext as well)

private final Set<String> s3Actions;

public OzoneGrant(Set<IOzoneObj> objects, Set<IAccessAuthorizer.ACLType> permissions) {
this(objects, permissions, Collections.emptySet());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 113 creates a new LinedHashSet instance and a Collections.unmodifiable instance from Collections.emptySet() passed here. Consider avoiding this by directly assigning members here:

this.objects = objects;
this.permission = permissions;
this.s3Actions = Collections.emptySet();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

assertEquals(permissions, grant.getPermissions());
assertEquals(s3Actions, grant.getS3Actions());
// Ensure the s3 actions are not modifiable
assertThrows(UnsupportedOperationException.class, () -> grant.getS3Actions().add("s3:GetObject"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "s3:" prefix, from here and other occurrences as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@fmorg-git fmorg-git changed the base branch from HDDS-13323-sts to master April 29, 2026 19:33
Fabian Morgan added 3 commits April 29, 2026 12:56
 Conflicts:
	hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/acl/AssumeRoleRequest.java
	hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/acl/RequestContext.java
	hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/security/acl/TestRequestContext.java
Copy link
Copy Markdown

@mneethiraj mneethiraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from Ranger integration pov.

@ChenSammi
Copy link
Copy Markdown
Contributor

Thanks @fmorg-git , and @mneethiraj for the review.

@ChenSammi ChenSammi merged commit fdd20f0 into apache:master Apr 30, 2026
90 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants